#include <stdio.h>
#include "../src/common/YXJwt.h"
#include "../src/common/YXLog.h"

int main() {

    // 生成令牌
    JwtBuilder* jwt_builder = yx_jwt_create();
    yx_jwt_add_claims_int(jwt_builder, "id", 2, 1314);
    char* jwt = yx_jwt_generate(jwt_builder);
    printf("jwt: %s\n", jwt);

    // 解析令牌
    Claims* claims = yx_jwt_parse(jwt);
    if (claims != NULL) {
        long id = yx_jwt_claims_get_int(claims, "id", 2);
        printf("id: %ld\n", id);
    } else {
        printf("jwt parse failed\n");
    }

    return 0;
}

